import java.util.Scanner;

public class TestDemo {
    public static void main(String[] args) {
//        获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
        int n = 7;
        for (int i = 31; i > 1 ; i-=2) {
            System.out.print(((n>>i)&1) + " ");
        }
        System.out.println( );
        for (int i = 30; i > 1 ; i-=2) {
            System.out.print(((n>>i)&1) + " ");
        }
    }
    public static void main6(String[] args) {
//        写一个函数返回参数二进制中 1 的个数 比如： 15 0000 1111 4 个 1

/*        int a = 15;
        int count = 0;
        for (int i = 0; i < 32; i++) {
            if( ((a>>i)&1) != 0 ) {
                count++;
            }
        }
        System.out.println(count);*/

//        优化

        int n = 15;
        int count = 0;
        while (n != 0) {
            if( (n&1) != 0) {
                count++;
            }
            n = n>>>1;
        }
        System.out.println(count);
    }

    public static void main5(String[] args) {
//        求n的阶乘
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 1; i <= n ; i++) {
            sum += fac(i);
        }
        System.out.println(sum);
    }
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }

    public static void main4(String[] args) {
//        求最大值方法的重载
        int a = 10;
        int b = 20;
        double c = 10.5;
        double d = 20.5;
        System.out.println(Max(a, b));
        System.out.println(Max(c, d));
        System.out.println(Max(a, c));
    }
    public static int Max(int x,int y) {
        return x>y?x:y;
    }
    public static double Max(double x,double y) {
        return x>y?x:y;
    }
    public static double Max(int x,double y) {
        return x>y?x:y;
    }

    public static void main3(String[] args) {
//        找出出现一次的数字
        int[] array = {1,2,3,2,1};
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            sum ^= array[i];
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
//        求阶乘和
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(fac1(n));

    }
    public static int fac1(int n) {
        int ret = 1;
        for (int i = 1; i < n; i++) {
            ret *= i;
        }
        return ret;
    }
//    求和的重载
    public static void main1(String[] args) {
        int a = 10;
        int b = 20;
        int ret = add(a,b);
        System.out.println(ret);
        double a2 = 10.5;
        double b2 = 20.5;
        double c2 = 30.5;
        double ret2 = add(a2,b2,c2);
        System.out.println(ret2);
    }
    public static int add(int x,int y) {
        return x + y;
    }
    public static  double add(double x,double y,double z) {
        return x + y + z;
    }
}
